﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Reap.Core.Caching {
	/// <summary>
	/// Cache manager interface
	/// Yuhao 2014.6.27
	/// </summary>
	public interface ICacheManager
	{
		/// <summary>
		/// Gets or sets the value associate with the specified key.
		/// </summary>
		/// <typeparam name="T">Type</typeparam>
		/// <param name="key">The key of the value to get</param>
		/// <returns>The value associate with the specified</returns>
		T Get<T>(string key);

		/// <summary>
		/// Adds the specified key and object to the cache.
		/// </summary>
		/// <param name="key">Key</param>
		/// <param name="data">Data</param>
		/// <param name="cacheTime">Cache time</param>
		void Set(string key, object data, int cacheTime);

		/// <summary>
		/// Get a value indicating whether the value associated with specified key is cached.
		/// </summary>
		/// <param name="key">Key</param>
		/// <returns>Result</returns>
		bool IsSet(string key);

		/// <summary>
		/// Removes the value with the specified key from the cache.
		/// </summary>
		/// <param name="key"></param>
		void Remove(string key);

		/// <summary>
		/// Removes items by pattern
		/// </summary>
		/// <param name="pattern">pattern</param>
		void RemoveByPattern(string pattern);

		/// <summary>
		/// Clear all cache data
		/// </summary>
		void Clear();
	}
}
